package com.hollysys.hollimsa.common.config;


import com.hollysys.hollimsa.common.filter.TenantInfoContextFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfiguration {

    @Bean
    public TenantInfoContextFilter tenantInfoContextFilter() {
        return new TenantInfoContextFilter();
    }

	  /**
     * 租户上下文filter
     */
    @Bean
    public FilterRegistrationBean<TenantInfoContextFilter> tenantInfoContextFilterRegist() {
        FilterRegistrationBean<TenantInfoContextFilter>  bean = new FilterRegistrationBean<>(tenantInfoContextFilter());
        bean.addUrlPatterns("/serviceMesh/*");
        bean.setOrder(1);
        return bean;
    }
}
